<?php 
/**
 * alltosun.com 意见反馈控制器
 * ============================================================================
 * 版权所有 (C) 2009-2011 北京互动阳光科技有限公司，并保留所有权利。
 * 网站地址: http://www.alltosun.com
 * ----------------------------------------------------------------------------
 * 许可声明：这是一个开源程序，未经许可不得将本软件的整体或任何部分用于商业用途及再发布。
 * ============================================================================
 * $Author: 高昂 (gaoa@alltosun.com) $
 * $Date: 2016-1-25 下午5:54:26 $
 * $Id: $
 */
class Action
{
    private $per_page = 10;
    
/**
    * 显示核销平台列表
    */
    public function index()
    {
        $page          = Request::Get('page_no', 1);
        $status        = Request::Get('status', 1);
        $is_advenced   = Request::Get('is_advenced', 0);
        $search_filter = Request::getParam('search_filter', array());

        //过滤条件
        $filter = array();
        $filter['status'] = $status;
        if (isset($search_filter['opinion']) && $search_filter['opinion']) {
            $filter[' `opinion` LIKE '] = '%'.$search_filter['opinion'].'%';
        }
        if (isset($search_filter['start_date']) && $search_filter['start_date']) {
            $filter['add_time >='] = $search_filter['start_date'].' 00:00:00';
        }
        if (isset($search_filter['end_date']) && $search_filter['end_date']) {
            $filter['add_time <='] = $search_filter['end_date'].' 23:59:59';
        }

        $group_platform_list  = array();
        
        $group_platform_list = get_data_list('opinion', $filter, ' ORDER BY `id` DESC ', $page, $this->per_page);
        
        Response::assign('opinion_list', $group_platform_list);
        Response::assign('status', $status);
        Response::assign('is_advenced', $is_advenced);
        Response::assign('search_filter', $search_filter);
        Response::display('admin/opinion_list.html');
    }
    
    
    /**
     * 伪删除(禁用)
     */
    public function delete()
    {
        //接收id
        $id  = Request::getParam('id');
    
        $ids = explode(',', $id);
        foreach ($ids as $k => $v) {
            _model('opinion')->update($v, array('status' => 0));
        }
        return 'ok';
    }
    
    /**
     * 恢复
     */
    public function change_status()
    {
        //接收id
        $id = Request::Get('id', 1);
    
        _model('opinion')->update($id, array('status' => 1));
    
        Response::assign('status', 1);
        Response::redirect(AnUrl('opinion/admin?status=1'));
    }
    
    
    
}


?>